<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-L-admin1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="../ladmin/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
    <link href="../ladmin/css/font.css" rel="stylesheet">
    <link href="../ladmin/css/xadmin.css" rel="stylesheet">
    <script src="../ladmin/js/jquery.min.js"></script>
    <script src="../ladmin/lib/layui/layui.js"></script>
    <script src="../ladmin/js/xadmin.js" type="text/javascript"></script>
    <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
    <script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
    <link href="../ladmin/lib/layui/css/modules/layer/default/layer.css" rel="stylesheet" type="text/css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body class="form-wrap" >

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">报修表</div>
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="component-form-group">
                <div class="layui-form-item">
                    <label class="layui-form-label">称呼</label>
                    <div class="layui-input-block">
                        <input type="text" name="name"  placeholder="请输入称呼" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
                        <input type="radio" name="sex" value="男" title="男" checked=""><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><div>男</div></div>
                        <input type="radio" name="sex" value="女" title="女"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><div>女</div></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">地址</label>
                    <div class="layui-input-block">
                        <input type="text" id="address" lay-verify="address" autocomplete="off" placeholder="请输入地址" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">报修方式</label>
                    <div class="layui-input-block">
                        <input type="radio" name="repairMethod" value="线上报修" title="线上报修" checked=""><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><div>线上报修</div></div>
                        <input type="radio" name="repairMethod" value="线下送修" title="线下送修"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><div>线下送修</div></div>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">问题描述</label>
                    <div class="layui-input-block">
                        <textarea id="description" placeholder="请输入内容" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" id="upload" >立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<script type="text/javascript">
    function check_upload(){

        var repairForm = {nickname:$("input[name='name']").val(),
            sex:$("input[name='sex']:checked").val(),
            address:$("input[id='address']").val(),
            repairMethod:$("input[name='repairMethod']:checked").val(),
            description:$("textarea[id='description']").val()
        };
        $.ajax({

            type: 'POST',
            url: 'sendRepairForm',
            async: true,
            traditional:true,
            data: JSON.stringify(repairForm),
            dataType: 'Text',
            contentType: "application/json;charset=UTF-8",
            success: function (data) {
                layer.msg("报修成功,请勿重复提交");
                setTimeout(function () {
                    location.reload();
                }, 1000);
            }

        });

    }

    $(function(){

        $("#upload").click(function(){

            check_upload();
            return false;
        })


    })
</script>


<style id="LAY_layadmin_theme">.layui-side-menu,.layadmin-pagetabs .layui-tab-title li:after,.layadmin-pagetabs .layui-tab-title li.layui-this:after,.layui-layer-admin .layui-layer-title,.layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-item>.layui-nav-child{background-color:#20222A !important;}.layui-nav-tree .layui-this,.layui-nav-tree .layui-this>a,.layui-nav-tree .layui-nav-child dd.layui-this,.layui-nav-tree .layui-nav-child dd.layui-this a{background-color:#009688 !important;}.layui-layout-admin .layui-logo{background-color:#20222A !important;}</style>
</body>


</html>